Skip to content

Conversation

@schiller-manuel
Copy link
Contributor

@schiller-manuel schiller-manuel commented Jan 18, 2026

fixes #6261

Summary by CodeRabbit

  • Tests

    • Added comprehensive test coverage for lazy-loaded routes with pathless layout configurations.
  • Refactor

    • Optimized route parent lookup logic to improve route generation performance.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

This PR fixes a regression where conflicting configuration paths error occurred when lazy-loading layout and index routes nested within a pathless route. The fix optimizes parent route resolution in the generator by replacing an upward loop search with a direct check on the immediate parent route.

Changes

Cohort / File(s) Summary
Generator logic optimization
packages/router-generator/src/generator.ts
Replaced fallback loop for parent route discovery with direct immediate-parent check via routeNodesByPath. Optimizes parent route resolution when closer parents exist.
Test fixtures for lazy layout and index in pathless routes
packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routes/__root.tsx, _layout/route.tsx, _layout/path.lazy.tsx, _layout/path.index.lazy.tsx
Added root route and nested lazy-loaded layout/path route definitions to test the pathless layout scenario with lazy-loaded child routes.
Generated route tree snapshot
packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routeTree.snapshot.ts
Generated test snapshot defining complete type-safe route hierarchy with lazy-loaded routes, route mappings, and module augmentation for TanStack Router integration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

package: router-generator

Suggested reviewers

  • nlynzaad

Poem

🐰 A pathless route once lost its way,
Conflicting paths made it go astray,
But now with parents found up front,
No loops, just checks—we've done the stunt!
Lazy routes hop without a fright,
The generator's fixed, all set right! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: fixing parent resolution logic in the router-generator, which directly addresses the bug fix referenced in issue #6261.
Linked Issues check ✅ Passed The code changes fix the parent route resolution logic by replacing a fallback loop with direct parent checking, which resolves the conflicting path error for lazy-loaded layout and index routes in pathless directories [#6261].
Out of Scope Changes check ✅ Passed All changes are scoped to the parent resolution logic fix and test files for the specific issue; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Jan 18, 2026

View your CI Pipeline Execution ↗ for commit 67c56ba

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 18m 42s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 37s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-18 11:00:41 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 18, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6412

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6412

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6412

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6412

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6412

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6412

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6412

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6412

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6412

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6412

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6412

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6412

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6412

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6412

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6412

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6412

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6412

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6412

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6412

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6412

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6412

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6412

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6412

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6412

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6412

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6412

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6412

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6412

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6412

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6412

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6412

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6412

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6412

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6412

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6412

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6412

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6412

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6412

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6412

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6412

commit: 67c56ba

@schiller-manuel schiller-manuel merged commit 1d7d9af into main Jan 18, 2026
6 checks passed
@schiller-manuel schiller-manuel deleted the fix-6261 branch January 18, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Conflicting configuration paths when lazy loading layout and index routes nested in pathless route

2 participants